package proxy;

import com.dys.proxy.DoSomething;
import com.dys.service.DoSomethingServiceImpl;
import com.dys.service.SomethingProxy;
import org.junit.Test;

/**
 * @Author: 疾风
 * @ClassName: SomeProxy
 * @Description: 测试静态代理
 * @CreateDate: 2024/10/21
 * @Version: v1.0.0
 */
public class SomeProxy {

    @Test
    public void testProxy(){
        // 1.获取目标对象
        DoSomething target = new DoSomethingServiceImpl();
        target.doSomething();
        // 2.获取代理对象
        DoSomething proxy = new SomethingProxy(target);
        // 3.通过代理对象执行方法
        System.out.println(proxy.doSomething());
    }
}
